<script setup lang="ts" name="PersonComponent">
import { ref } from 'vue';
// 哪个是响应式就给哪个加
let name = ref('setup中定义变量');
let age = ref(20);
let tel = '123456789';
// 方法
const call = () => {
  // 加上响应式后修改ref需要用value改变
  name.value = '改变name';
  age.value++;
  console.log(name);
  console.log(age);
};
</script>
<template>
  <div class="person">
    <h2>姓名：{{ name }}</h2>
    <h2>年龄{{ age }}</h2>
    <button @click="call"></button>
  </div>
</template>

<style scoped>
.person {
  color: red;
}
</style>
